package Lamada;

public class Test {
    public static void main(String[] args) {
//        Swim s=new Swim() {
//            public void swimming() {
//                System.out.println("I am swimming");
//            }
//        };
//        s.swimming();
        //Lamada只能简化函数式接口的匿名内部类
        //函数式接口：接口中只有一个抽象方法
        //Lambda表达式：(参数)->{方法体}
        Swim s=()-> System.out.println("I am swimming");
        s.swimming();
    }
@FunctionalInterface //确保接口只有一个抽象方法
    interface Swim{
        void swimming();
    }
}
